package com.intercept;

import org.springframework.aop.support.StaticMethodMatcherPointcut;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class UmpMethodPointcut extends StaticMethodMatcherPointcut {

    public boolean matches(Method method, Class<?> targetClass) {
        // 仅支持public方法
        if (!Modifier.isPublic(method.getModifiers()) ) {
            return false;
        }
        //此处对注解进行了过滤
        UmpMethod annotation = method.getAnnotation(UmpMethod.class);
        if (null == annotation){
            return false;
        }
        return true;
    }


}